<?php

namespace Sharks\Core\Support\Base;

/**
 * 将数组对象包装为对象属性使用
 */
class ObjWrapper {

    private $attributes;

    public function __construct(array $attributes) {
        $this->attributes = $attributes;
    }

    public function __get($name) {
        Precondition::check(isset($this->attributes[$name]), "未找到属性名称");
        return $this->attributes[$name];
    }
}